/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.fallback.promotion;

import com.enation.app.javashop.core.client.feignimpl.promotion.PromotionGoodsClientFeginImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.promotion.fulldiscount.vo.FullDiscountVO;
import com.enation.app.javashop.model.promotion.halfprice.vo.HalfPriceVO;
import com.enation.app.javashop.model.promotion.minus.vo.MinusVO;
import com.enation.app.javashop.model.promotion.seckill.dos.SeckillApplyDO;
import com.enation.app.javashop.model.promotion.tool.dos.PromotionGoodsDO;
import com.enation.app.javashop.model.promotion.tool.dto.PromotionDTO;
import com.enation.app.javashop.model.promotion.tool.vo.PromotionVO;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 促销商品熔断
 *
 * @author zh
 * @version v7.0
 * @date 19/5/27 下午6:44
 * @since v7.0
 */
@Component
public class PromotionGoodsClientFallbackFactory extends BaseFallbackFactory<PromotionGoodsClientFeginImpl> implements FallbackFactory {


    @Override
    protected PromotionGoodsClientFeginImpl fallback() {
        return new PromotionGoodsClientFallback();
    }

    /**
     * 促销商品熔断
     *
     * @author zh
     * @version v7.0
     * @date 19/5/27 下午6:44
     * @since v7.0
     */
    @Component
    public static class PromotionGoodsClientFallback implements PromotionGoodsClientFeginImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public void delPromotionGoods(Long goodsId, String type, Long activityId) {
            logger.error("删除活动商品出错，活动id为" + activityId);
        }

        @Override
        public void delPromotionGoods(List<Long> delSkuIds) {
            logger.error("删除商品参与的促销活动出错");
        }


        @Override
        public List<PromotionVO> getPromotion(Long goodsId) {
            logger.error("查询某商品参与的促销活动出错，商品id" + goodsId);
            return null;
        }

        @Override
        public void rollbackSeckillStock(List<PromotionDTO> promotionDTOList) {
            logger.error("回滚秒杀库存异常");
        }

        @Override
        public boolean addSeckillSoldNum(List<PromotionDTO> promotionDTOList) {
            logger.error("增加秒杀销售库存异常");
            return false;
        }

        @Override
        public List<SeckillApplyDO> getSeckillGoodsList(Long seckillId, String status) {
            logger.error("获取秒杀活动的详细异常");
            return null;
        }

        @Override
        public void rollbackGroupbuyStock(List<PromotionDTO> promotionDTOList, String orderSn) {
            logger.error("回滚团购库存异常");
        }

        @Override
        public boolean cutGroupbuyQuantity(String orderSn, List<PromotionDTO> promotionDTOList) {
            logger.error("扣减团购库存异常");
            return false;
        }

        @Override
        public void updateGroupbuyGoodsInfo(Long[] goodsIds) {
            logger.error("更新团购商品信息异常");
        }

        @Override
        public boolean renewGroupbuyBuyNum(Long goodid, Integer num, Long productId) {
            logger.error("renewGroupbuyBuyNum详细异常");

            return false;
        }

        @Override
        public void addGroupbuyQuantity(String orderSn) {
            logger.error("增加团购库存异常");
        }

        @Override
        public List<PromotionGoodsDO> getPromotionGoods(Long activityId, String promotionType) {
            logger.error("获取某活动的促销商品异常");
            return null;
        }

        @Override
        public FullDiscountVO getFullDiscountModel(Long fdId) {
            logger.error("查询满优惠活动异常");
            return null;
        }

        @Override
        public MinusVO getMinusFromDB(Long minusId) {
            logger.error("获取单品立减异常");
            return null;
        }

        @Override
        public HalfPriceVO getHalfPriceFromDB(Long id) {
            logger.error("获取第二件半价异常");
            return null;
        }

        @Override
        public List<PromotionGoodsDO> getPromotionGoodsList(String promotionType, Long nowTime) {

            logger.error("getPromotionGoodsList异常");

            return null;
        }

        @Override
        public void updatePromotionEndTime(Long endTime, Long pgId) {

            logger.error("updatePromotionEndTime异常");

        }

        @Override
        public void updateExchangeGoodsTime(Long goodsId, Long startTime, Long endTime) {
            logger.error("updateExchangeGoodsTime异常");
        }
    }
}
